package com.project.controller.ZLGLcontroller;

import com.github.pagehelper.PageInfo;
import com.project.bean.CustomerBean;
import com.project.service.ZLGLService.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RequestMapping("customer")
@RestController
public class CutomerController {
    @Autowired
    private ICustomerService service;
    @RequestMapping("add")
    public String add( CustomerBean customer){
        service.add(customer);
        return "ok";
    }

    @RequestMapping("update")
    public String update(int id,String inCharge, String tel, String scope) {
        service.update(id,inCharge,tel,scope);
        return "ok";
    }

    @RequestMapping("findById")
    public CustomerBean findById(int id) {
        return service.findById(id);
    }

    @RequestMapping("findByItem")
    public PageInfo<CustomerBean> cutAllByItem(int pageNO, String name, String scope) {
        return service.cutAllByItem(pageNO, name, scope);
    }

    @RequestMapping("findAll")
    public List<CustomerBean> findAll(){
        return service.findAll();
    }

}

